import page from '../../../pages/pages.vue'
import { getRankList, updateScore, showMsg } from '../../../../vuex/action.js'

export default {
  data() {
    return {
      name: '',
      list: [],
      pages: {
        start: 0,
        totalPages: 0,
        limit: 20
      }
    }
  },
  methods: {
    getRankList() {
      this.xGetRankList({
        start: this.pages.start,
        limit: this.pages.limit
      }).then((res) => {
        console.log(res)
      })
    },
    searchRankList() {
      this.xGetRankList({
        name: this.name
      }).then((res) => {
        console.log(res)
      })
    }
  },
  vuex: {
    actions: {
      xGetRankList: getRankList,
      xUpdateScore: updateScore,
      xShowMsg: showMsg
    }
  },
  components: {
    'vue-page': page
  },
  ready() {
    this.getRankList()
  }
}
